cc.Class({
	extends: cc.Component,
	properties: {
		dongNode: cc.Node,
		xiNode: cc.Node,
		nanNode: cc.Node,
		beiNode: cc.Node,
		dirsNode: cc.Node,
		countLabel: cc.Label,
	},

	setDir: function (curChairID, chairCount, count) {
		let nodes = [this.dongNode, this.nanNode, this.xiNode, this.beiNode];
		for (let item of nodes) {
			item.active = false;
		}
		if (curChairID != null) {
			if (chairCount != 2) {
				nodes[curChairID].active = true;
			}
			else {
				if (curChairID == 0) {
					nodes[curChairID].active = true;
				}
				else {
					nodes[2].active = true;
				}
			}
		}
		this.countLabel.string = '剩余牌数:'+count;
	},

	setRotation: function (myChairID, chairCount) {
		if (myChairID == 0) {
			this.dirsNode.rotation = 0;
		}
		else if (myChairID == 1) {
			if (chairCount != 2) {
				this.dirsNode.rotation = 90;
			}
			else {
				this.dirsNode.rotation = 180;
			}
		}
		else if (myChairID == 2) {
			this.dirsNode.rotation = 180;
		}
		else if (myChairID == 3) {
			this.dirsNode.rotation = 270;
		}
	},
});
